package controller;

import model.*;
import java.util.ArrayList;

public class ProductCtr
{
    private ProductContainer pc;
    
   public ProductCtr()
   {
       pc =  ProductContainer.getInstance();
   }
  
   public boolean createProduct(String barcode, String productName, String productType,
                        double price, String location, int amount) 
   {
       Product p = new Product(barcode, productName, productType, price,
                                location, amount);
       ProductContainer pc = ProductContainer.getInstance();
       if(p!=null) {
           pc.addProduct(p);
           return true;
        }
        else return false;
   }
   
   public ArrayList<Product> findProduct(String productName)
   {
       ProductContainer pc = ProductContainer.getInstance();
       return pc.findProduct(productName);
   }
   
   public Product getProduct(String serialNumber)
   {
       ProductContainer pc = ProductContainer.getInstance();
       return pc.getProduct(serialNumber);
   }
   
   public boolean updateProduct(String barcode, String productName, String productType,
                        double price, String location, String serialNumber, boolean availability, int amount)
   {
       // Not needed for this use case
       return false;
   }
   
   public boolean deleteProduct(String serialNumber)
   {
       // Not needed for this use case
       return false;
   }
}
